//https://dart.cn/language/#mixins
/**
Mixin 是一种在多个类层次结构中重用代码的方法。下面的是声明一个 Mixin 的做法：
 */
import 'my_classes.dart'; // 导入Spacecraft类

 mixin Piloted {
  int astronauts = 1;

  void describeCrew() {
    print('Number of astronauts: $astronauts');
  }
}

class PilotedCraft extends Spacecraft with Piloted {
  PilotedCraft(String name, DateTime launchDate) : super(name, launchDate);

  PilotedCraft.unlaunched(String name) : super.unlaunched(name);
}

void main() {
  // 创建一个PilotedCraft对象
  var pilotedCraft = PilotedCraft('Apollo 11', DateTime(1969, 7, 16));

  // 调用Spacecraft类的describe方法
  pilotedCraft.describe();

  // 调用Piloted mixin的describeCrew方法
  pilotedCraft.describeCrew();
}
